package com.echo.register.oss.controller;

import com.echo.register.common.result.Result;
import com.echo.register.oss.service.FileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @ClassName: FileApiController
 * @Package: com.echo.register.oss.controller
 * @Description:
 * @Author 谢同学
 * @Create 2023/12/31 18:58
 * @Version 1.0
 */
@RestController
@Api(tags = "阿里云oss文件上传")
@RequestMapping("/api/oss/file")
public class FileApiController {
    @Autowired
    private FileService fileService;

    @ApiOperation("上传文件到阿里云oss")
    @PostMapping("/fileUpload")
    public Result<String> fileUpload(MultipartFile file){
        return Result.ok(fileService.upload(file));
    }
}
